<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/pages/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加产品常见问题</title>
<script src="${ctx}/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function checkForm(){
	var pId=document.getElementById("pId").value;
	var queContent=document.getElementById("queContent").value;
	var revertContent=document.getElementById("revertContent").value;
	if(pId==0){
		alert("请选择所属产品！");
		return false;
		};
	if(queContent==null||queContent==""){
		alert("请输入问题内容！");
		return false;
		};
	if(revertContent==null||revertContent==""){
		alert("请输入回复内容！");
		return false;
					}
		return true;
	
}

</script>
<script type="text/javascript">
	function getPro() {
		var pId = document.getElementById("pId");
		pId.length = 0;
		$.ajax( {
			url : "${ctx}/proInfo.do?method=findProByClass",
			type : "post",
			data : "flag=" + $("#cId").val(),
			dataType : "json",
			success : function(t) { //判断回调函数		
				$.each(t, function(i) {
					var opt = document.createElement("option");
					opt.text = t[i].proModel;
					opt.value = t[i].pId;
					pId.options.add(opt, 0);
				});
			}
		})
	}
</script>
</head>
<body>
<div id="mainDiv" class="x-panel">
<div id="titleDiv" class="x-panel-header"><!--  此处是附页标题  注2 --></div>
<div id="bodyDiv">
<div id="toolbarDiv" class="x-toolbar"><!-- 此处是工具栏    注3--></div>
<div id="panelBodyDiv" class="x-panel-body"><!-- 此处是主体部分    注4-->
<form id="proForm" name="proForm" method="post" target="_self" action="${ctx}/proQues.do?method=addProQues" onsubmit="return checkForm();">
<table width="100%" class="datatable">
	<tr>
		<th align="right" width="15%">选择所属产品：</th>
			<td align="left">
		<select id="cId" onclick="getPro()" name="cId">
			<option value="0">……产品类别……</option>
			<c:forEach var="pClass" items="${list}">
				<option value="${pClass.cId}">${pClass.className}</option>
			</c:forEach>
		</select> <select id="pId" style="width: 120px;" name="pId">
			<option value="0">……产品名称……</option>
		</select></td>

	</tr>
	<tr>
		<th align="right" width="15%">问题内容：</th>
		<td align="left"><textarea rows="6" cols="60" name="queContent" id="queContent"></textarea>
		</td>
	</tr>
	<tr>
		<th align="right" width="15%">回复内容：</th>
		<td align="left">
		<textarea rows="6" cols="60" name="revertContent" id="revertContent"></textarea>
		</td>
	</tr>
	<tr>
		<th align="right" width="15%">选择硬软件：</th>
		<td>
			 <input type="radio" name="classFlag" value="1"checked="checked" />硬件 
			<input type="radio" name="classFlag" value="2" />软件</td>
	</tr>
	<tr>
		<th></th>
		<td align="center"><input type="submit" value="提交"/>
		&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" />
		</td>
	</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>